package com.ego.controller;

import com.ego.pojo.Content;
import com.ego.pojo.EasyUIDatagrid;
import com.ego.pojo.EgoResult;
import com.ego.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ContentController {

    @Autowired
    private ContentService contentService;

    @RequestMapping("/content/query/list")
    public EasyUIDatagrid selectPage(Long categoryId,int page,int rows){
        return contentService.selectContentByPage(categoryId,page,rows);
    }

    @RequestMapping("/content/save")
    public EgoResult save(Content content){
        return contentService.saveContent(content);
    }

    @RequestMapping("/rest/content/edit")
    public EgoResult edit(Content content){
        return contentService.updateContent(content);
    }


    @RequestMapping("/content/delete")
    public EgoResult delete(Long[] ids){
        return contentService.deleteContent(ids);
    }

}
